/*
 * XML Type:  named-query
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.NamedQuery
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML named-query(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class NamedQueryImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.NamedQuery
{

    /**  */
	private static final long serialVersionUID = -5482393658925551061L;


	public NamedQueryImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName QUERY$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "query");
    private static final javax.xml.namespace.QName HINT$2 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "hint");
    private static final javax.xml.namespace.QName NAME$4 =
        new javax.xml.namespace.QName("", "name");


    /**
     * Gets the "query" element
     */
    public java.lang.String getQuery()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(QUERY$0, 0);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "query" element
     */
    public org.apache.xmlbeans.XmlString xgetQuery()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(QUERY$0, 0);
            return target;
        }
    }

    /**
     * Sets the "query" element
     */
    public void setQuery(java.lang.String query)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(QUERY$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(QUERY$0);
            }
            target.setStringValue(query);
        }
    }

    /**
     * Sets (as xml) the "query" element
     */
    public void xsetQuery(org.apache.xmlbeans.XmlString query)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(QUERY$0, 0);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(QUERY$0);
            }
            target.set(query);
        }
    }

    /**
     * Gets a List of "hint" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint> getHintList()
    {
        final class HintList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint get(int i)
                { return NamedQueryImpl.this.getHintArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint old = NamedQueryImpl.this.getHintArray(i);
                NamedQueryImpl.this.setHintArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint o)
                { NamedQueryImpl.this.insertNewHint(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint old = NamedQueryImpl.this.getHintArray(i);
                NamedQueryImpl.this.removeHint(i);
                return old;
            }

            @Override
			public int size()
                { return NamedQueryImpl.this.sizeOfHintArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new HintList();
        }
    }

    /**
     * Gets array of all "hint" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint[] getHintArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(HINT$2, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "hint" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint getHintArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint)get_store().find_element_user(HINT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "hint" element
     */
    public int sizeOfHintArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(HINT$2);
        }
    }

    /**
     * Sets array of all "hint" element
     */
    public void setHintArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint[] hintArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(hintArray, HINT$2);
        }
    }

    /**
     * Sets ith "hint" element
     */
    public void setHintArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint hint)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint)get_store().find_element_user(HINT$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(hint);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "hint" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint insertNewHint(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint)get_store().insert_element_user(HINT$2, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "hint" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint addNewHint()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.QueryHint)get_store().add_element_user(HINT$2);
            return target;
        }
    }

    /**
     * Removes the ith "hint" element
     */
    public void removeHint(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(HINT$2, i);
        }
    }

    /**
     * Gets the "name" attribute
     */
    public java.lang.String getName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }

    /**
     * Gets (as xml) the "name" attribute
     */
    public org.apache.xmlbeans.XmlString xgetName()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$4);
            return target;
        }
    }

    /**
     * Sets the "name" attribute
     */
    public void setName(java.lang.String name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(NAME$4);
            }
            target.setStringValue(name);
        }
    }

    /**
     * Sets (as xml) the "name" attribute
     */
    public void xsetName(org.apache.xmlbeans.XmlString name)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(NAME$4);
            }
            target.set(name);
        }
    }
}
